﻿; (function (global) {

    'use strict';

    global.HelpProvider = {};

    HelpProvider.fillCandidates = function (grid) {
        SolvingHelper.fillCandidates(grid);
    }

    HelpProvider.check = function (grid, solvedGrid) {

        var errorFilledCells = [];
        for (var i = 0; i < 9; i++) {
            for (var j = 0; j < 9; j++) {
                var solvedCell = solvedGrid.cells[i][j];
                var cell = grid.cells[i][j];
                if (cell.value !== 0 && cell.value != solvedCell.value) {
                    errorFilledCells.push(cell);
                }
            }
        }

        return errorFilledCells;
    },

    HelpProvider.isCompleted = function (grid, solvedGrid) {

        for (var i = 0; i < 9; i++) {
            for (var j = 0; j < 9; j++) {
                var solvedCell = solvedGrid.cells[i][j];
                var cell = grid.cells[i][j];
                if (cell.value != solvedCell.value) {
                    return false;
                }
            }
        }

        return true;
    }


}(this));